//
//  CGTableViewCell.m
//  CookingGarden
//
//  Created by lanou on 15/10/26.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "CGTableViewCell.h"
#import "CGRemindCollectionViewCell.h"
@interface CGTableViewCell ()<UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>

@end


@implementation CGTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _categoryLable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 180)];
        _categoryLable.text = @"用刀技巧";
        [self.contentView addSubview:_categoryLable];
        
        UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
        layout.minimumLineSpacing = 5;
        layout.itemSize = CGSizeMake(SCREEN_WIDTH / 2 - 17, 175);
        layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        
        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(30, 0, SCREEN_WIDTH - 30, 180) collectionViewLayout:layout];
        _collectionView.backgroundColor = [UIColor whiteColor];
        _collectionView.dataSource = self;
        _collectionView.delegate = self;
        [self.contentView addSubview:_collectionView];
        
        // 注册
        [_collectionView registerClass:[CGRemindCollectionViewCell class] forCellWithReuseIdentifier:@"reuse"];
        
    }
    
    return self;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 10;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CGRemindCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];
    cell.backgroundColor = [UIColor redColor];
    return cell;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
